package org.musicsweet.controller;

import org.musicsweet.anotation.AuthReq;
import org.musicsweet.entity.SysRoleMenuRealtion;
import org.musicsweet.result.ResultData;
import org.musicsweet.service.SysRoleMenuRealtionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 角色菜单关系Controller
 */
@RestController
@RequestMapping("/sysRoleMenuRealtion")
public class SysRoleMenuRealtionController {


    @Autowired
    private SysRoleMenuRealtionService sysRoleMenuRealtionService;

    /**
     * 根据id查询角色菜单关系
     *
     * @param sysRoleMenuRealtion
     * @return
     */
    @AuthReq
    @RequestMapping("/getSysRoleMenuRealtionById")
    public ResultData<SysRoleMenuRealtion> getSysRoleMenuRealtionById(@RequestBody SysRoleMenuRealtion sysRoleMenuRealtion) {
        return sysRoleMenuRealtionService.getSysRoleMenuRealtionById(sysRoleMenuRealtion);
    }

    /**
     * 多条件查询角色菜单关系
     *
     * @param sysRoleMenuRealtion
     * @return
     */
    @AuthReq
    @RequestMapping("/getSysRoleMenuRealtionList")
    public ResultData<List<SysRoleMenuRealtion>> getSysRoleMenuRealtionList(@RequestBody SysRoleMenuRealtion sysRoleMenuRealtion) {
        return sysRoleMenuRealtionService.getSysRoleMenuRealtionList(sysRoleMenuRealtion);
    }


    /**
     * 添加角色菜单关系
     *
     * @param sysRoleMenuRealtion
     * @param token
     * @return
     */
    @RequestMapping("/addSysRoleMenuRealtion")
    public ResultData addSysRoleMenuRealtion(@RequestBody SysRoleMenuRealtion sysRoleMenuRealtion, String token) {
        return sysRoleMenuRealtionService.addSysRoleMenuRealtion(sysRoleMenuRealtion, token);
    }


    /**
     * 修改角色菜单关系
     *
     * @param sysRoleMenuRealtion
     * @param token
     * @return
     */
    @RequestMapping("/updateSysRoleMenuRealtion")
    public ResultData updateSysRoleMenuRealtion(@RequestBody SysRoleMenuRealtion sysRoleMenuRealtion, String token) {
        return sysRoleMenuRealtionService.updateSysRoleMenuRealtion(sysRoleMenuRealtion, token);
    }


    /**
     * 删除角色菜单关系
     *
     * @param sysRoleMenuRealtion
     * @return
     */
    @RequestMapping("/delSysRoleMenuRealtion")
    public ResultData delSysRoleMenuRealtion(@RequestBody SysRoleMenuRealtion sysRoleMenuRealtion) {
        return sysRoleMenuRealtionService.delSysRoleMenuRealtion(sysRoleMenuRealtion);
    }

}